<?php

class Control_Model_Table_About extends Zend_Db_Table_Abstract {

    protected $_name = 'about_content';

    public function getContent() {
        $select = $this->select();
        $select->order('id ASC')
                ->limit('1');
        $UserData = $this->_db->query($select)->fetchAll();
        return $UserData[0];
    }

    public function getDataID($id) {
        $id = (int) $id;
        $row = $this->fetchRow('id =' . $id);
        if (!$row) {
            //           throw new Exception("Count not find row $id");
        } else {
            return $row->toArray();
        }
    }

    public function getAll() {
        $select = $this->select();
        $select->order('id DESC');
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

    public function getAllServices() {
        $select = $this->select();
        $select->where('upper=0')
                ->order('id DESC');
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

    public function updateServices($title, $text) {
        $data = array(
            'title' => $title,
            'text' => $text
        );
        $this->update($data, 'id= ' . '1');
    }

}

